import { Watcher } from "./watcher"

export class Dep {
  static active: Watcher|null = null
  private subscribers = new Set<Watcher>()

  depend() {
    if(Dep.active) this.subscribers.add(Dep.active)
  }

  notify() {
    this.subscribers.forEach(watcher=>watcher.update())
  }
}

